﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BusinessLogic.Command;

namespace CO9APPFORM
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var login = new GetUserCommand(txtUsername.Text, txtPassword.Text);
            login.Execute();
            
            if (login.Result != null)
            {
                Session["CurrentUser"] = login.Result;
                Response.Redirect("CandidateInfoList.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "LoginError", "alert('User name for Password are incorrected please try again.');", true);
            }
        }
    }
}